package {
	import flash.text.TextFormat;
	import flash.text.TextField;
	import flash.events.MouseEvent;
	import flash.display.Sprite;
	
	
	public class Button extends Sprite {
		private var text:TextField = new TextField();
		private var textFormat:TextFormat = new TextFormat();
		public function Button() {
			graphics.beginFill(0x0000FF,1);
			graphics.drawRect(-110, -35, 220, 70);
			setFormat();
			addText();
			
			addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}
		private function addText():void{
			text.defaultTextFormat = textFormat;
			text.text = 'Default';
			text.x = -200;
			text.y = -25;
			text.width = 400;
			text.height = 300;
			addChild(text);
		}
		private function setFormat():void{
			textFormat.color=0xFFFFFF;
			textFormat.size = 25;
			textFormat.align = 'center';
			textFormat.font = 'Comic sans MS';
		}
		private function onMouseOver(event:MouseEvent):void{
			alpha = 0.5;
		}
		private function onMouseOut(event:MouseEvent):void{
			alpha = 1;
		}
		public function get textButtom():TextField{
			return text;
		}
		public function set textButtom(value:TextField){
			text = value;
		}
		
	}
}
